<template>
  <div class="city" @click="$router.push('/city')">
      <van-icon name="location" />
      {{city}}
  </div>
</template>

<script>
// 引入获取当地城市
// import "../untils/city"
import getcity from "../untils/city"
export default {
    data () {
        return {
            city:''
        }
    },
     mounted(){
         // 调用获取城市的方法
         getcity()// 要返回promise对象
         .then(res=>{
             console.log(res);// 武汉市
             this.city=res
         })
     }
}
</script>

<style>
   .city{
       color: #1989fa;
   }
</style>